package com.kyzh.core.dialog

import android.annotation.SuppressLint
import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.databinding.DataBindingUtil
import com.kyzh.core.R
import com.kyzh.core.pager.me.user.VerifiedActivity
import com.kyzh.core.databinding.DialogToverifyBinding
import com.kyzh.core.utils.startActivity


private var toVerifyDialog:AlertDialog?=null

fun Activity.showToVerifyDialog(){
    toVerifyDialog = AlertDialog.Builder(this, R.style.kyzhGuestLoginDialog)
            .setView(getView())
            .create()

    toVerifyDialog?.show()
}
@SuppressLint("ClickableViewAccessibility")
private fun Activity.getView():View{
    val binding = DataBindingUtil.inflate<DialogToverifyBinding>(LayoutInflater.from(this),R.layout.dialog_toverify,null,false)
    binding.btGet.setOnClickListener {
        toVerifyDialog?.dismiss()
        startActivity<VerifiedActivity>()
    }
    binding.cancel.setOnClickListener {
        toVerifyDialog?.dismiss()
    }
    return binding.root
}